<?php

namespace App\Exceptions;

use Exception;
use Illuminate\Http\Request;

class CustomException extends Exception
{
    public function __construct(string $message = "", int $code = 201)
    {
        $this->message = $message;
        $this->code = $code;
        //parent::__construct($message, $code);
    }
    public function render(Request $request)
    {
        return response()->json([
            'status'=>'error',
            'data' => $this->message,
            'code'=>$this->code,
        ], $this->code);
    }
}
